package com.ruoyi.resume.provider;

import org.apache.ibatis.jdbc.SQL;
import java.util.Map;

public class ResumeTagSqlProvider {

    // 插入 resume_tag 表
    public String insertResumeTag(Map<String, Object> params) {
        return new SQL() {{
            INSERT_INTO("resume_tag");
            INTO_COLUMNS("resume_id", "tag_id", "tag_value");
            INTO_VALUES("#{resumeTag.resumeId}", "#{resumeTag.tagId}", "#{resumeTag.tagValue}");
        }}.toString();
    }

    // 根据 resumeId 读取 resume_tag 表中的所有记录
    public String selectResumeTagsByResumeId(Map<String, Object> params) {
        return new SQL() {{
            SELECT("resume_id, tag_id, tag_value");
            FROM("resume_tag");
            WHERE("resume_id = #{resumeId}");
        }}.toString();
    }

    // 根据 resumeId 和 tagId 删除 resume_tag 表中的记录
    public String deleteResumeTag(Map<String, Object> params) {
        return new SQL() {{
            DELETE_FROM("resume_tag");
            WHERE("resume_id = #{resumeId}");
            WHERE("tag_id = #{tagId}");
        }}.toString();
    }
}
